fix(cli): close #283 bug 4 — tighten consolidate grouping + prune path-named projects#445
Open
Maicololiveras wants to merge 1 commit into
Conversation
… grouping + prune path-named projects Bug 4 from issue Gentleman-Programming#283 has two halves, both addressed here. Grouping (data-loss footgun): groupSimilarProjects unioned every project that shared ANY directory. A noisy ancestor (e.g. $HOME or a session root) listed under dozens of projects collapsed the whole store into one component, so `projects consolidate --all` proposed merging unrelated projects into a single bucket. Now skip any directory shared by more than maxSharedProjectsForDirMatch (3) distinct projects; genuine rename signals (a directory shared by a few projects) still group. Cleanup of pre-existing garbage: add `--paths-only` to `projects prune`, restricting the 0-observation candidate set to projects whose name is a filesystem path. Mirrors the write-boundary rejection in normalizeExplicitWriteProject (ContainsAny(name, "/\\")), so cleanup targets exactly the names newer versions already refuse to create. Reuses the existing prune machinery (dry-run, interactive selection, cascade delete). Regression coverage (unit + command-level): noisy shared dir not grouped; small shared dir still groups; name similarity untouched; path-like detector table; `consolidate --all` proposes no merge for noisy-shared-dir projects; `prune --paths-only` lists and deletes only path-named empty projects.
4f3a806 to
053923f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #283 — the remaining approved scope (bug 4).
Per your retest, bugs 1–3 are already fixed on
main. This PR covers the two halves of bug 4, kept tight and additive.🛟 Grouping — the data-loss footgun
groupSimilarProjectsunioned every project that shared any directory. A noisy ancestor ($HOMEor a session root) listed under many projects collapsed the whole store into one component, soprojects consolidate --allproposed merging dozens of unrelated projects into a single bucket.maxSharedProjectsForDirMatch(3) distinct projects.🧹 Cleanup of pre-existing path-named garbage
--paths-onlyflag onengram projects prunenarrows the 0-observation candidate set to projects whose name is a filesystem path.normalizeExplicitWriteProject(ContainsAny(name, "/\\")), so it targets exactly the names newer versions already refuse to create.✅ Regression coverage (TDD)
prune --paths-onlylists only path-named empty projects.go build ./...,go vet, andgofmtall clean on the touched packages.Suggested labels (external contributor can't self-apply):
type:bug·priority:high·status:needs-review